package com.handtransaction.listener;

import com.handtransaction.common.TimerAssembly;
import com.handtransaction.service.impl.GoodsServiceImpl;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class DataSaveListener implements ServletContextListener {
    private ServletContext sc = null;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        TimerAssembly timerAssembly = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()).getBean(TimerAssembly.class);
        timerAssembly.DataRegularSave();
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
